package com.wjjun.utils;

import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.view.Gravity;
import android.view.View;

import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
import com.bigkoo.pickerview.builder.TimePickerBuilder;
import com.bigkoo.pickerview.listener.CustomListener;
import com.bigkoo.pickerview.listener.OnOptionsSelectListener;
import com.bigkoo.pickerview.listener.OnTimeSelectListener;
import com.bigkoo.pickerview.view.OptionsPickerView;
import com.bigkoo.pickerview.view.TimePickerView;
import com.blankj.utilcode.util.KeyboardUtils;
import com.wjjun.customview.R;

/**
 * 选项对话框工具
 */
public class OptionsDialogUtils {

    public static OptionsPickerView getOptionsPickerView(Activity context, int titleResId, OnOptionsSelectListener listener) {
        KeyboardUtils.hideSoftInput(context);
        return new OptionsPickerBuilder(context, listener)
                .setTitleColor(Color.BLACK)//标题文字颜色
                .setSubmitColor(context.getResources().getColor(R.color.picker_view_confirm_color))//确定按钮文字颜色
                .setCancelColor(context.getResources().getColor(R.color.picker_view_cancel_color))//取消按钮文字颜色
                .setTitleBgColor(context.getResources().getColor(R.color.picker_view_title_bg_color))//标题背景颜色 Night mode
                .setBgColor(context.getResources().getColor(R.color.picker_view_content_bg_color))//滚轮背景颜色 Night mode
                .setTitleText(context.getString(titleResId))
                .build();
    }

    public static TimePickerView getTimePickerView(Activity context, boolean[] show, OnTimeSelectListener listener) {
        KeyboardUtils.hideSoftInput(context);
        return new TimePickerBuilder(context, listener)
                .setType(show)//显示年月日
                .setTitleColor(Color.BLACK)//标题文字颜色
                .setSubmitColor(context.getResources().getColor(R.color.picker_view_confirm_color))//确定按钮文字颜色
                .setCancelColor(context.getResources().getColor(R.color.picker_view_cancel_color))//取消按钮文字颜色
                .setTitleBgColor(context.getResources().getColor(R.color.picker_view_title_bg_color))//标题背景颜色 Night mode
                .setBgColor(context.getResources().getColor(R.color.picker_view_content_bg_color))//滚轮背景颜色 Night mode
                .isCenterLabel(false)
                .build();
    }

}
